Telegram Group & Telegram Channel
📚 Мини-справочник по основным типам данных C++

Делимся компактным справочником по основным типам данных в C++. Сохраняйте себе на будущее.

🔢 Целочисленные типы

int — 4 байта, от -2,147,483,648 до 2,147,483,647
short — 2 байта, от -32,768 до 32,767
long — 4 байта (Windows) или 8 байт (Unix)
long long — 8 байт, от -9,223,372,036,854,775,808 до 9,223,372,036,854,775,807

Модификаторы:
unsigned — только положительные числа, удваивает верхний предел
signed — со знаком (по умолчанию)

unsigned int counter = 100;
short temperature = -15;
long long population = 7800000000;


🔡 Символьные типы

char — 1 байт, обычные символы ASCII
wchar_t — 2 или 4 байта, широкие символы (Unicode)
char16_t — 2 байта, символы UTF-16 (C++11)
char32_t — 4 байта, символы UTF-32 (C++11)

char letter = 'A';
wchar_t unicodeChar = L'Ф';
char16_t utf16Char = u'Ж';


🔄 Числа с плавающей точкой

float — 4 байта, точность ~7 цифр, диапазон ±3.4e±38
double — 8 байт, точность ~15 цифр, диапазон ±1.7e±308
long double — 8-16 байт, точность ≥ double, диапазон зависит от компилятора

float price = 19.99f;   // 'f' суффикс для float
double pi = 3.14159265359;
long double precise = 1.23456789123456789L; // 'L' суффикс


🧮 Логический тип

bool — 1 байт, значения: true или false

bool isActive = true;
bool hasPermission = false;


🗄 Производные типы

Массивы: int numbers[5];
Указатели: int* ptr;
Ссылки: int& ref = value;
Строки:
• C-строки: char str[] = "Hello";
• std::string: std::string text = "Hello";

🔄 Автоматическое определение типа (C++11)

auto x = 10;        // int
auto y = 3.14; // double
auto z = "Hello"; // const char*


🧩 Тип Void

void — отсутствие типа (для функций без возвращаемого значения)
void* — указатель на данные любого типа

🔍 Как узнать размер типа


cout << "Размер int: " << sizeof(int) << " байт" << endl;


💡 Полезные советы

1. Используйте **size_t
для индексации и размеров
2. Для целых чисел с гарантированным размером используйте типы из <cstdint>: int32_t, uint64_t
3. Для денежных расчетов избегайте float из-за погрешностей округления

Библиотека C/C++ разработчика #буст



tg-me.com/cppproglib/5526
Create:
Last Update:

📚 Мини-справочник по основным типам данных C++

Делимся компактным справочником по основным типам данных в C++. Сохраняйте себе на будущее.

🔢 Целочисленные типы

int — 4 байта, от -2,147,483,648 до 2,147,483,647
short — 2 байта, от -32,768 до 32,767
long — 4 байта (Windows) или 8 байт (Unix)
long long — 8 байт, от -9,223,372,036,854,775,808 до 9,223,372,036,854,775,807

Модификаторы:
unsigned — только положительные числа, удваивает верхний предел
signed — со знаком (по умолчанию)

unsigned int counter = 100;
short temperature = -15;
long long population = 7800000000;


🔡 Символьные типы

char — 1 байт, обычные символы ASCII
wchar_t — 2 или 4 байта, широкие символы (Unicode)
char16_t — 2 байта, символы UTF-16 (C++11)
char32_t — 4 байта, символы UTF-32 (C++11)

char letter = 'A';
wchar_t unicodeChar = L'Ф';
char16_t utf16Char = u'Ж';


🔄 Числа с плавающей точкой

float — 4 байта, точность ~7 цифр, диапазон ±3.4e±38
double — 8 байт, точность ~15 цифр, диапазон ±1.7e±308
long double — 8-16 байт, точность ≥ double, диапазон зависит от компилятора

float price = 19.99f;   // 'f' суффикс для float
double pi = 3.14159265359;
long double precise = 1.23456789123456789L; // 'L' суффикс


🧮 Логический тип

bool — 1 байт, значения: true или false

bool isActive = true;
bool hasPermission = false;


🗄 Производные типы

Массивы: int numbers[5];
Указатели: int* ptr;
Ссылки: int& ref = value;
Строки:
• C-строки: char str[] = "Hello";
• std::string: std::string text = "Hello";

🔄 Автоматическое определение типа (C++11)

auto x = 10;        // int
auto y = 3.14; // double
auto z = "Hello"; // const char*


🧩 Тип Void

void — отсутствие типа (для функций без возвращаемого значения)
void* — указатель на данные любого типа

🔍 Как узнать размер типа


cout << "Размер int: " << sizeof(int) << " байт" << endl;


💡 Полезные советы

1. Используйте **size_t
для индексации и размеров
2. Для целых чисел с гарантированным размером используйте типы из <cstdint>: int32_t, uint64_t
3. Для денежных расчетов избегайте float из-за погрешностей округления

Библиотека C/C++ разработчика #буст

BY Библиотека C/C++ разработчика | cpp, boost, qt


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/cppproglib/5526

View MORE
Open in Telegram


Библиотека C C разработчика | cpp boost qt Telegram | DID YOU KNOW?

Date: |

China’s stock markets are some of the largest in the world, with total market capitalization reaching RMB 79 trillion (US$12.2 trillion) in 2020. China’s stock markets are seen as a crucial tool for driving economic growth, in particular for financing the country’s rapidly growing high-tech sectors.Although traditionally closed off to overseas investors, China’s financial markets have gradually been loosening restrictions over the past couple of decades. At the same time, reforms have sought to make it easier for Chinese companies to list on onshore stock exchanges, and new programs have been launched in attempts to lure some of China’s most coveted overseas-listed companies back to the country.

Telegram and Signal Havens for Right-Wing Extremists

Since the violent storming of Capitol Hill and subsequent ban of former U.S. President Donald Trump from Facebook and Twitter, the removal of Parler from Amazon’s servers, and the de-platforming of incendiary right-wing content, messaging services Telegram and Signal have seen a deluge of new users. In January alone, Telegram reported 90 million new accounts. Its founder, Pavel Durov, described this as “the largest digital migration in human history.” Signal reportedly doubled its user base to 40 million people and became the most downloaded app in 70 countries. The two services rely on encryption to protect the privacy of user communication, which has made them popular with protesters seeking to conceal their identities against repressive governments in places like Belarus, Hong Kong, and Iran. But the same encryption technology has also made them a favored communication tool for criminals and terrorist groups, including al Qaeda and the Islamic State.

Библиотека C C разработчика | cpp boost qt from ar


Telegram Библиотека C/C++ разработчика | cpp, boost, qt
FROM USA